package cn.liutao.order.entity.po;

import cn.liutao.common.entity.BaseEntity;
import cn.liutao.common.entity.Validation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 *  实体类。
 *
 * @author liutao
 * @since 2023-11-02
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "order")
public class Order extends BaseEntity implements Serializable {

    /**
     * 主键
     */
    @Id(keyType = KeyType.Auto)
    private Integer id;

    /**
     * 订单编号
     */
    private String orderNo;

    /**
     * 关联用户
     */
    private Integer userId;

    /**
     * 关联购餐桌表
     */
    @NotNull(message = "请选择餐桌",groups = Validation.AddGroup.class)
    private Integer tableId;

    /**
     * 用餐人数
     */
    @NotNull(message = "请选择输入用餐人数",groups = Validation.AddGroup.class)
    @Min(value = 1,message = "用餐人数不能少于1人")
    private Integer peopleQuantity;

    /**
     * 备注
     */
    private String remark;

    /**
     * 支付价格
     */
    private BigDecimal totalPrice;


    /**
     * 下单数量
     */
    private Integer totalQuantity;

    /**
     * 下单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 支付时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime payTime;

    /**
     * 订单状态
     */
    private Integer status;




}
